-
Notifications
You must be signed in to change notification settings - Fork 34
[interop] Add support for importing and exporting declarations, as well as multi-file output #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nikeokoronkwo
merged 21 commits into
dart-lang:main
from
nikeokoronkwo:interop/import-export
Aug 1, 2025
Merged
[interop] Add support for importing and exporting declarations, as well as multi-file output #418
nikeokoronkwo
merged 21 commits into
dart-lang:main
from
nikeokoronkwo:interop/import-export
Aug 1, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # web_generator/lib/src/interop_gen/transform/transformer.dart # web_generator/lib/src/js/typescript.types.dart
- added import support - added gen of code inside file in the case of non multi-import - added support for multiple file generation - using `TransformManager` for managing transformation of code
# Conflicts: # web_generator/lib/src/ast/declarations.dart # web_generator/lib/src/interop_gen/transform.dart # web_generator/lib/src/interop_gen/transform/transformer.dart # web_generator/lib/src/js/typescript.types.dart
srujzs
reviewed
Jul 22, 2025
web_generator/test/integration/interop_gen/project/input/a.d.ts
Outdated
Show resolved
Hide resolved
web_generator/test/integration/interop_gen/import_export_input.d.ts
Outdated
Show resolved
Hide resolved
srujzs
approved these changes
Jul 30, 2025
copybara-service bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Aug 4, 2025
…, web, webdriver Revisions updated by `dart tools/rev_sdk_deps.dart`. ai (https://github.com/dart-lang/ai/compare/7fbe88a..72a9283): 72a9283 2025-07-31 Jacob MacDonald add --exclude-tool option to exclude tools by name (dart-lang/ai#253) 0dbbd8b 2025-07-30 Jacob MacDonald only run in shell when on windows and running a .bat file (dart-lang/ai#252) 0858b0b 2025-07-28 Jacob MacDonald further prompt refinement, discourage use of temp ids and encourage getting the widget tree often (dart-lang/ai#249) 912c1f3 2025-07-28 Jacob MacDonald release dart_mcp v0.3.3 (dart-lang/ai#247) 0f7cba8 2025-07-28 Jacob MacDonald add analytics tracking for prompts (dart-lang/ai#246) dartdoc (https://github.com/dart-lang/dartdoc/compare/882aea9..414953e): 414953ed 2025-08-04 Sam Rawlins Simplify how inheritance is computed. (dart-lang/dartdoc#4079) ecosystem (https://github.com/dart-lang/ecosystem/compare/d5233c6..2fe3618): 2fe3618 2025-08-01 dependabot[bot] Bump the github-actions group with 3 updates (dart-lang/ecosystem#361) protobuf (https://github.com/dart-lang/protobuf/compare/44ecd74..0b73b0d): 0b73b0d 2025-07-30 Devon Carew workspace, formatting, and proto version updates (google/protobuf.dart#1033) a664760 2025-07-30 Devon Carew various CI workflow updates (google/protobuf.dart#1035) test (https://github.com/dart-lang/test/compare/6aeb1e4..953e828): 953e8282 2025-08-01 Nate Bosch Drop executable arguments forwarding (dart-lang/test#2528) tools (https://github.com/dart-lang/tools/compare/2a2a2d6..5e977d6): 5e977d6f 2025-07-30 Jacob MacDonald Fix mixtures of parentheses and spaces in windows command paths (dart-lang/tools#2138) 607340ca 2025-07-29 Devon Carew disable failing test (dart-lang/tools#2136) vector_math (https://github.com/google/vector_math.dart/compare/13f185f..3939545): 3939545 2025-08-04 Kevin Moore Bump min SDK to 3.7, update dependencies, reformat (google/vector_math.dart#348) web (https://github.com/dart-lang/web/compare/da1dd5d..1d5771b): 1d5771b 2025-07-31 Nikechukwu [interop] Add support for importing and exporting declarations, as well as multi-file output (dart-lang/web#418) webdriver (https://github.com/google/webdriver.dart/compare/cfab787..595649d): 595649d 2025-08-01 dependabot[bot] Bump nanasess/setup-chromedriver (google/webdriver.dart#331) Change-Id: Ia014bf6cafa9edcdaf453edda9cd5ecff516e16d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443625 Auto-Submit: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #378
Fixes #387
This PR is for adding support for multiple file processing, with support for exporting and importing declarations even between files.
It makes use of a
TransformManager
which transforms various files and uses aProgramMap
to memoize and keep track of dependencies across files, which helps in reducing expensive transform calls to declarations already referenced from other files.Rather than transforming every declaration in a source file, the type checker gets the declarations exported from the file, and processes those declarations and its dependencies only, making processing faster
The type checker helps to resolve types and imports, as well as resolve import declarations. Import declarations are not parsed by default so that we know we are only making use of imports actually referenced in code (which is helpful in single outputs for instance).
(The program map makes use of
package:path
sPathMap
to easily work with paths for files and declarations, as the TS output may resolve either to a relative import in the file, or may reference the declaration externally as an absolute path).Imported declarations are declared as
ReferredType
s with aurl
property, which allows for referencing the normalExports are rewritten based on how they are specified, and are processed after transformation (since they are separate declarations and may be referenced as they are.
Imports are processed depending on the presence of the file: